package homework;

import java.util.Scanner;

public class test5 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //键盘输入
        System.out.print("请输入第一个整数：");
        int one = scan.nextInt();
        System.out.print("请输入第二个整数：");
        int two = scan.nextInt();
        System.out.print("请输入您要进行的运算(1:表示加法,2:表示减法,3:表示乘法,4:表示除法): ");
        int three = scan.nextInt();
        //使用swith判断语句分类
        //1.箭头函数写法
//        switch (three) {
//            case 1 ->System.out.println(one+"+"+two+"="+(one+two));
//            case 2 ->System.out.println(one+"-"+two+"="+(one-two));
//            case 3 ->System.out.println(one+"*"+two+"="+(one*two));
//            case 4 ->System.out.println(one+"/"+two+"="+(one*1.0/two));
//            default -> System.out.println("您输入的运算符有误");
//        }
        //2.一般写法
        switch (three){
            case 1:
                System.out.println(one+"+"+two+"="+(one+two));
                break;
            case 2:
                System.out.println(one+"-"+two+"="+(one-two));
                break;
            case 3:
                System.out.println(one+"*"+two+"="+(one*two));
                break;
            case 4:
                System.out.println(one+"/"+two+"="+(one*1.0/two));
                break;
            default:
                System.out.println("您输入的运算符有误");
                break;
        }

    }
}
